Skip to content

Proposed documentation for proposed Model element #39710

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Open
wants to merge 7 commits into
base: main
Choose a base branch
from

Conversation

zachernuk
Copy link

@zachernuk zachernuk commented May 27, 2025

Description

This PR adds API documentation about the proposed HTML Model element, a browser-native feature for the in-line display of 3D content. It includes illustrations of some core concepts like perspective, lighting and appropriate file formats.

Motivation

The Model element is a totally new web feature and it'll be exceptionally difficult to add documentation in a piecemeal fashion. I'm hoping that this covers the core concepts enough to author new pages from, and matches the MDN house style well enough that other folks can improve them to the point that they are real!

Additional details

I am submitting provisional documentation for the HTML model element, a feature that is the major source of discussion in the W3C Immersive Web CG (https://github.com/immersive-web/model-element/ )
and which is available as a feature preview in visionOS 2.4. I am an editor of the specification and have been facilitating the discussion around it.

While the specification doesn’t have a lot of detail, the API in visionOS is based on the consensus discussion in the CG, and is described in the Model Element explainer: (https://github.com/immersive-web/model-element/blob/main/explainer.md )

There is also a WebGL/WebXR-based interactive explainer demo available here:
https://immersive-web.github.io/model-element/explainer_demo.html

We also have public samples being contributed by multiple browser vendors in the model element samples repository.
https://immersive-web.github.io/model-element-samples/

We have previously submitted related additions to the WHATWG HTML specification as via an introductory issue and initial PR for the specification stub.
whatwg/html#10901
whatwg/html#11191

Related issues and pull requests

WHATWG/HTML

the Web Platform Tests repository

HTML-ARIA

zachernuk added 3 commits May 27, 2025 10:51
A full suite of the currently agreed-upon API and capability of the Model element, as discussed in the Immersive Web CG
rebuilt with the yarn builder so the lockfile should match upstream
Copied the yarn lockfile back to the upstream state
@zachernuk zachernuk requested review from mdn-bot and a team as code owners May 27, 2025 18:21
@zachernuk zachernuk requested review from estelle and sideshowbarker and removed request for a team May 27, 2025 18:21
@github-actions github-actions bot added Content:HTML Hypertext Markup Language docs Content:WebAPI Web API docs system [PR only] Infrastructure and configuration for the project size/xl [PR only] >1000 LoC changed labels May 27, 2025
@zachernuk
Copy link
Author

@mkeblx @LaszloGombos @cabanier Here's a run at the MDN docs! LMK if there's anything obviously outside of our discussions on it so far.

Copy link
Contributor

github-actions bot commented May 27, 2025

Preview URLs (20 pages)
Flaws (1)

Note! 19 documents with no flaws that don't need to be listed. 🎉

URL: /en-US/docs/Web/HTML/Reference/Elements/model
Title: <model>: The HTML Model element
Flaw count: 1

  • broken_links:
    • Can't resolve /en-US/docs/Web/Accessibility/ARIA/Reference/Roles/model_role
External URLs (13)

URL: /en-US/docs/Web/API/HTMLModelElement/boundingBoxCenter
Title: HTMLModelElement: boundingBoxCenter property


URL: /en-US/docs/Web/API/HTMLModelElement/boundingBoxExtents
Title: HTMLModelElement: boundingBoxExtents property


URL: /en-US/docs/Web/API/HTMLModelElement/environmentMap
Title: HTMLModelElement: environmentMap property


URL: /en-US/docs/Web/API/HTMLModelElement/playbackRate
Title: HTMLModelElement: playbackRate property


URL: /en-US/docs/Web/HTML/Reference/Elements/model
Title: <model>: The HTML Model element

(comment last updated: 2025-05-29 20:52:58)

zachernuk and others added 2 commits May 27, 2025 13:49
Updated casing on some attribute/property names, update to the richer paths on things like Content categories
Copy link
Member

@Josh-Cena Josh-Cena left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Some random drive-by reviews. Not comprehensive in any way, but they indicate some common problems that would need to be fixed throughout.

Also we need browser compat data for this. It should be shipping in at least one browser to be documented.

@@ -9836,4 +9836,4 @@ yoctocolors@^2.0.0:
zwitch@^2.0.0, zwitch@^2.0.4:
version "2.0.4"
resolved "https://registry.yarnpkg.com/zwitch/-/zwitch-2.0.4.tgz#c827d4b0acb76fc3e685a4c6ec2902d51070e9d7"
integrity sha512-bXE4cR/kVZhKZX/RjPEflHaKVhUVl85noU3v6b8apfQEc1x4A+zBxjZ4lN8LqGd6WZ3dl98pY4o717VFmoPp+A==
integrity sha512-bXE4cR/kVZhKZX/RjPEflHaKVhUVl85noU3v6b8apfQEc1x4A+zBxjZ4lN8LqGd6WZ3dl98pY4o717VFmoPp+A==
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Revert


- While it provides benefits for all devices and User Agents, the `<model>` element has particular value on platforms with stereoscopic and/or head-tracking capabilities, such as Head-Mounted Displays (HMDs). It can be used as declarative alternative to the WebXR API to provide spatial content.

## Object fit
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

These should be H3 headings. The H2 sequence is exactly those defined in the page template

Comment on lines 31 to 32
A model's contents is set to automatically fit within the portal's
`width` and `height` dimensions at the moment that the `ready` Promise
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

General comment: please don't wrap your prose like this. Either wrap at each period, or don't wrap and just have paragraph breaks


Setting the `stagemode` to `orbit` immediately has these consequences for the model element's `entityTransform`:

- Transform is <strong>`orbit-fit`</strong>:
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Use Markdown

This example demonstrates how to confirm that both a model's scene and environment map resources are ready for rendering, and how to gracefully address failed parsing:

```js
let modelElem = document.getElementById("model");
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Use const where possible


## See also

- [model.ready](/en-US/docs/Web/API/HTMLModelElement/ready)
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Suggested change
- [model.ready](/en-US/docs/Web/API/HTMLModelElement/ready)
- [`HTMLModelElement.ready`](/en-US/docs/Web/API/HTMLModelElement/ready)


## See also

- {{domxref("HTMLModelElement")}}: Interface used to define the `HTMLModelElement.entityTransform` property
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Suggested change
- {{domxref("HTMLModelElement")}}: Interface used to define the `HTMLModelElement.entityTransform` property
- {{domxref("HTMLModelElement")}}

We don't add explanatory text for see also

zachernuk added 2 commits May 27, 2025 23:33
Remove arbitrary wrapping,
Change `let` to `const`,
Fixed the 'ARIA role' reference urls,
Demoted some headings to be in line with MDN standards,
Applied markdown-based bolding
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Content:HTML Hypertext Markup Language docs Content:WebAPI Web API docs size/xl [PR only] >1000 LoC changed system [PR only] Infrastructure and configuration for the project
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants